jQuery(document).ready(function () {
    selectList();
    $("#resetBtn").on("click",function () {
        $("#userName").val("");
        $("#userId").val("");
        $("#telephone").val("");
    })
});
function queryParams(params) {
    return getQueryParams(params, "searchForm");
}
function selectList(){
    $('#userTable').bootstrapTable("destroy");
    $('#userTable').bootstrapTable({
        method: "post",
        url: rootPath+"/attendCon/ajax/getUserList"
    });
}
function attendRecord(type) {
    var selections= $('#userTable').bootstrapTable('getSelections');
    if (selections.length == 0) {
        layer.msg('请选择数据进行操作！');
        return;
    }
    var ids = "";
    for(var i=0;i<selections.length;i++){
        ids += selections[i].user_id;
        if(i<selections.length-1){
            ids +=",";
        }
    }
    commonJs.confirmMsg("确定对以下员工进行记录【"+ids+"】？（注：对同一员工的重复记录将仅保存最后一次记录）",function () {
        showMode();
        $.ajax({
            url: rootPath + '/attendCon/ajax/attendRecord',
            data: {ids: ids,type:type},
            type: 'POST',
            asyc: false,
            dataType: "json", //可以是text，如果用text，返回的结果为字符串；如果需要json格式的，可是设置为json
            ContentType: "application/json; charset=utf-8",
            success: function (data) {
                if ('0000' == data.code) {
                    parent.commonJs.alertMsg(data.msg, function () {
                        closeMode();
                    });
                } else {
                    commonJs.alertMsg(data.msg, function () {
                        closeMode();
                    });
                }
            },
            error: function (data) {
                commonJs.alertMsg('操作失败，服务异常！', function () {
                    closeMode();
                });
            }
        });
    });
}